package homework.day03;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入名字：");
        String name = scanner.nextLine();
        System.out.println("请输入密码：");
        String pwd = scanner.nextLine();
        System.out.println("请输入nick：");
        String nick = scanner.nextLine();
        System.out.println("请输入年龄：");
        int age = scanner.nextInt();
        User user = new User(name, pwd, nick, age);
        FileOutputStream fos = new FileOutputStream(name + ".obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(user);
        System.out.println("写出完毕！");
        oos.close();
    }
}
